home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.0 KB | 152 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWMGC.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWGC_H
- #define FWGC_H
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTYLE_H
- #include "FWStyle.h"
- #endif
-
- #ifndef FWSHAPE_H
- #include "FWShape.h"
- #endif
-
- // ----- Macintosh Includes -----
-
- #if defined(FW_BUILD_MAC) && !defined(__QUICKDRAW__)
- #include <QuickDraw.h>
- #endif
-
- //========================================================================================
- // •• Defines
- //========================================================================================
-
- //========================================================================================
- // •• Forward Declarations
- //========================================================================================
-
- class XMPFacet;
- class XMPShape;
- class XMPWindow;
- class XMPCanvas;
-
- //========================================================================================
- // •• class FW_CGraphicContext
- //========================================================================================
-
- class FW_CGraphicContext
- {
- //----------------------------------------------------------------------------------------
- // • Constructors/Destructors
- //
- public:
- FW_CGraphicContext(XMPFacet *facet, XMPShape* clipShape = NULL);
- FW_CGraphicContext(XMPWindow* xmpWindow);
-
- virtual ~FW_CGraphicContext();
-
- //----------------------------------------------------------------------------------------
- // • New API
- //
- public:
- XMPCanvas* GetCanvas() const;
-
- // ----- Conversion -----
- FW_SPlatformPoint AsPlatformPoint(const FW_CPoint& point);
- FW_SPlatformRect AsPlatformRect(const FW_CRect& rect);
- FW_PlatformRegion AsPlatformRegion(XMPShape* shape);
-
- // ----- ClipShape -----
- void GetClipShape(XMPShape* clipShape);
- void SetClipShape(XMPShape* clipShape);
- // a copy of clipShape is used
-
- void SyncGraphicContext(XMPShape* clipShape);
- // a copy of clipShape is used
-
- // ----- Getters -----
- XMPFacet* GetXMPFacet() const
- {return fXMPFacet;}
-
- private:
- void InvalidPreviousGCCache();
-
- //----------------------------------------------------------------------------------------
- // • Public but for internal use only
- //
- public:
- void SelectInkAndStyle(FW_CInk ink, FW_CStyle style,
- FW_ShapeCategory shapeType, FW_ShapeFills shapeFill);
-
- //----------------------------------------------------------------------------------------
- // • Data Members
- //
- private:
- FW_CGraphicContext *fPreviousGraphicContext;
-
- FW_Boolean fWindowFocus; // true if focusing on a window instead of a facet
-
- FW_Boolean fForceSelect; // when true, always call SelectInGC for the ink and style
-
- XMPFacet* fXMPFacet;
- XMPCanvas* fXMPCanvas;
-
- unsigned long fInkSeed;
- unsigned long fStyleSeed;
-
- FW_ShapeCategory fShapeCategory; // Category of the last shape (geometric or typographic)
- FW_ShapeFills fShapeFills; // how the last shape was drawn (framed or filled)
-
- #ifdef FW_BUILD_MAC
- GrafPtr fPreviousPort;
- FW_SPlatformPoint fCurOrigin;
- FW_PlatformRegion fOldClip;
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_CWinPen fCurrentPen;
- FW_CWinBrush fCurrentBrush;
-
- FW_CWinPen fPreviousPen;
- FW_CWinBrush fPreviousBrush;
- #endif
- };
-
- //========================================================================================
- // •• Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // • FW_CGraphicContext::GetCanvas
- //----------------------------------------------------------------------------------------
- inline XMPCanvas* FW_CGraphicContext::GetCanvas() const
- {
- return fXMPCanvas;
- }
-
- #endif